/*
 * @lc app=leetcode.cn id=2180 lang=typescript
 *
 * [2180] 统计各位数字之和为偶数的整数个数
 */

// @lc code=start
function countEven(num: number): number {
    let count = 0;
    for (let i = 1; i <= num; i++) {
        if (
            i
                .toString()
                .split("")
                .reduce((col, cur) => {
                    return (col += parseInt(cur));
                }, 0) %
                2 ===
            0
        )
            count++;
    }
    return count;
}
// @lc code=end
